from rest_framework import serializers


from apps.users.models import User


class UserViewModelSerializers(serializers.ModelSerializer):

    class Meta:
        model=User
        fields=['id','username','email','mobile']

class UserViewSerializers(serializers.Serializer):
    id=serializers.IntegerField(read_only=True)
    username=serializers.CharField()
    mobile=serializers.CharField()
    email=serializers.CharField()
    password=serializers.CharField(write_only=True)

    def create(self, validated_data):
        user = User.objects.create_user(**validated_data)
        return user

